import 'package:yurun_smartmerchants/models/inventory_detail_entity.dart';

inventoryDetailEntityFromJson(InventoryDetailEntity data, Map<String, dynamic> json) {
	if (json['last'] != null) {
		data.last = json['last'];
	}
	if (json['content'] != null) {
		data.content = new List<InventoryDetailContent>();
		(json['content'] as List).forEach((v) {
			data.content.add(new InventoryDetailContent().fromJson(v));
		});
	}
	return data;
}

Map<String, dynamic> inventoryDetailEntityToJson(InventoryDetailEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['last'] = entity.last;
	if (entity.content != null) {
		data['content'] =  entity.content.map((v) => v.toJson()).toList();
	}
	return data;
}

inventoryDetailContentFromJson(InventoryDetailContent data, Map<String, dynamic> json) {
	if (json['modifiedTime'] != null) {
		data.modifiedTime = json['modifiedTime']?.toString();
	}
	if (json['batchNo'] != null) {
		data.batchNo = json['batchNo']?.toString();
	}
	if (json['quantity'] != null) {
		data.quantity = json['quantity']?.toDouble();
	}
	if (json['productId'] != null) {
		data.productId = json['productId']?.toInt();
	}
	if (json['surplus'] != null) {
		data.surplus = json['surplus']?.toDouble();
	}
	if (json['packageContainer'] != null) {
		data.packageContainer = json['packageContainer']?.toString();
	}
	if (json['id'] != null) {
		data.id = json['id']?.toInt();
	}
	if (json['operation'] != null) {
		data.operation = json['operation']?.toInt();
	}
	return data;
}

Map<String, dynamic> inventoryDetailContentToJson(InventoryDetailContent entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['modifiedTime'] = entity.modifiedTime;
	data['batchNo'] = entity.batchNo;
	data['quantity'] = entity.quantity;
	data['productId'] = entity.productId;
	data['surplus'] = entity.surplus;
	data['packageContainer'] = entity.packageContainer;
	data['id'] = entity.id;
	data['operation'] = entity.operation;
	return data;
}